About 1910 letters

About 10 minutes

#HTML's elements and attributes

HTML elements are defined by a start tag, content, and an end tag:

<tagname attribute="value">content</tagname>
  • Attribute values can be enclosed in either single quotes or double quotes.

For example:

<!-- This is a comment --> <h1> Heading Level 1 </h1> <h2> Heading Level 2 </h2> <p> Paragraph </p> <a href="https://xplanc.org/"> Hyperlink </a>

HTML

Heading Level 1

Heading Level 2

Paragraph

Hyperlink

#Block Elements and Inline Elements

Block elements take up the full width of a line, while inline elements are part of a line.

<h1> Heading is a block element </h1> <p> Paragraph is a block element </p> <p> <span>span</span> and <a href='https://xplanc.org/'> hyperlink </a> are inline elements </p>

HTML

Heading is a block element

Paragraph is a block element

span and hyperlink are inline elements

#Spaces and Line Breaks

In HTML, whitespace characters are part of the syntax but typically display as a single space. To show multiple spaces or line breaks, use the escape character &nbsp; for spaces and the <br/> tag for line breaks.

<p> A B <!-- Only one space is displayed --> A&nbsp;&nbsp;B <!-- Two spaces are displayed --> <br/> <!-- Line break --> C <!-- No line break, only one space displayed --> D C&nbsp;&nbsp;D </p>

HTML

A B A  B
C D

Created in 5/16/2025

Updated in 5/21/2025